Create a mock ExecutionContext manually using a plain object cast to the interface, and pass it directly to the enhancer's method. Use Test.createTestingModule() only to resolve the enhancer with its dependencies. This approach tests the logic in complete isolation from the HTTP stack.
Guards — mock ExecutionContext and Reflector; call canActivate() directly.
Interceptors — create a mock CallHandler returning of(mockData); call intercept() and subscribe.
Pipes — call transform() directly with test values; assert return value or thrown exception.
Filters — call catch() with a mock exception and mock ArgumentsHost; assert res.status().json() calls.
Use jest.spyOn(reflector, 'getAllAndOverride') to control metadata reading in guard tests.